<div style="height:15px;"></div>
<div id="tb_chtj"></div>

<script>
layui.use(['jquery', 'layer'], function() {
	var $ = layui.jquery;
	var layer = layui.layer;
		
	//出货统计
	window.getChtj = function(){
		$.ajax({
			type: "POST",
			url: "?c=dailyV2&m=index",
			data: "_ajax=1&fun=_getChtj&factory_id="+factoryId+"&from="+from,
			dataType: "json",
			success: function(res){
				if(res.code == 1){
					var list = res.data.list;
	
					var html = '';
					for(i in list) {
	
						factory_name = list[i]['factory_name'];
						stat = list[i]['stat'];
						
						html += '	<table class="layui-table" id="tb_ch">';
						//html += '		<caption>【'+factory_name+'】</caption>';
						html += '		<tr>';
						html += '			<td colspan="2" class="title"><a href="javascript:showDetail(\'上月出货-订单列表\', \'{:url(\'\', \'_ajax=1&fun=_getChtj&detail=1&factory_id=\'.$thisFactoryId.\'&from=\'.$thisFrom)}\')" style="text-decoration:underline">上月出货金额</a></td>';
						html += '			<td colspan="2" class="title"><a href="javascript:showDetail(\'本月出货-订单列表\', \'{:url(\'\', \'_ajax=1&fun=_getChtj&detail=2&factory_id=\'.$thisFactoryId.\'&from=\'.$thisFrom)}\')" style="text-decoration:underline">本月出货金额</a></td>';
						html += '			<td colspan="2" class="title"><a href="javascript:showDetail(\'昨日出货-订单列表\', \'{:url(\'\', \'_ajax=1&fun=_getChtj&detail=3&factory_id=\'.$thisFactoryId.\'&from=\'.$thisFrom)}\')" style="text-decoration:underline">昨日出货金额</a></td>';
						html += '			<td colspan="2" class="title"><a href="javascript:showDetail(\'昨日入仓-订单列表\', \'{:url(\'\', \'_ajax=1&fun=_getChtj&detail=4&factory_id=\'.$thisFactoryId.\'&from=\'.$thisFrom)}\')" style="text-decoration:underline">昨日入仓金额</a></td>';
						html += '			<td colspan="2" class="title"><a href="javascript:showDetail(\'今日出货-订单列表\', \'{:url(\'\', \'_ajax=1&fun=_getChtj&detail=5&factory_id=\'.$thisFactoryId.\'&from=\'.$thisFrom)}\')" style="text-decoration:underline">今日出货金额</a></td>';
						html += '			<td colspan="2" class="title"><a href="javascript:showDetail(\'昨日下单-订单列表\', \'{:url(\'\', \'_ajax=1&fun=_getChtj&detail=6&factory_id=\'.$thisFactoryId.\'&from=\'.$thisFrom)}\')" style="text-decoration:underline">昨日下单件数</a></td>';
						html += '			<td colspan="2" class="title"><a href="javascript:showDetail(\'今日下单-订单列表\', \'{:url(\'\', \'_ajax=1&fun=_getChtj&detail=7&factory_id=\'.$thisFactoryId.\'&from=\'.$thisFrom)}\')" style="text-decoration:underline">今日下单件数</a></td>';
						html += '			';
						html += '			<td colspan="1" class="title">本月目标</td>';
						html += '			<td colspan="1" class="title">完成度</td>';
						html += '			<td colspan="1" class="title">货期</td>';
						html += '			<td colspan="1" class="title">年度</td>';
						html += '		</tr>';
						html += '		<tr>';
						html += '			<td colspan="2" class="value">FOB=<span id="last_month_shipment_fob">'+stat['last_month']['money_fob']+'</span>元<br>';
						html += '			CMT=<span id="last_month_shipment_cmt">'+stat['last_month']['money_cmt']+'</span>元<br>新CMT=<span id="last_month_shipment_cmt2">'+stat['last_month']['money_cmt2']+'</span>元<br>加工费=<span id="last_month_cost_money">'+stat['last_month']['money_cost']+'</span>元</td>';
						html += '			<td colspan="2" class="value">FOB=<span id="month_shipment_fob">'+stat['month']['money_fob']+'</span>元<br>';
						html += '			CMT=<span id="month_shipment_cmt">'+stat['month']['money_cmt']+'</span>元<br>新CMT=<span id="month_shipment_cmt2">'+stat['month']['money_cmt2']+'</span>元<br>加工费=<span id="month_cost_money">'+stat['month']['money_cost']+'</span>元</td>';
						html += '			<td colspan="2" class="value">FOB=<span id="yestoday_shipment_fob">'+stat['yestoday_over']['money_fob']+'</span>元<br>';
						html += '	CMT=<span id="yestoday_shipment_cmt">'+stat['yestoday_over']['money_cmt']+'</span>元<br>新CMT=<span id="yestoday_shipment_cmt2">'+stat['yestoday_over']['money_cmt2']+'</span>元<br>加工费=<span id="yestoday_cost_money">'+stat['yestoday_over']['money_cost']+'</span>元</td>';
						html += '			<td colspan="2" class="value">FOB=<span id="yestoday_store_fob">'+stat['yestoday_store']['money_fob']+'</span>元<br>';
						html += '	CMT=<span id="yestoday_store_cmt">'+stat['yestoday_store']['money_cmt']+'</span>元<br>新CMT=<span id="yestoday_store_cmt2">'+stat['yestoday_store']['money_cmt2']+'</span>元<br>加工费=<span id="yestoday_store_money">'+stat['yestoday_store']['money_cost']+'</span>元</td>';
						
						html += '			<td colspan="2" class="value">FOB=<span id="today_shipment_fob">'+stat['today_over']['money_fob']+'</span>元<br>';
						html += '	CMT=<span id="today_shipment_cmt">'+stat['today_over']['money_cmt']+'</span>元<br>新CMT=<span id="today_shipment_cmt2">'+stat['today_over']['money_cmt2']+'</span>元<br>加工费=<span id="today_cost_money">'+stat['today_over']['money_cost']+'</span>元</td>';
						html += '			<td colspan="2" class="value">FOB=<span id="yestoday_order_count_fob">'+stat['yestoday']['order_count_fob']+'</span>件<br>CMT=<span id="yestoday_order_count_cmt">'+stat['yestoday']['order_count_cmt']+'</span>件<br>新CMT=<span id="yestoday_order_count_cmt2">'+stat['yestoday']['order_count_cmt2']+'</span>件</td>';
						html += '			<td colspan="2" class="value">FOB=<span id="today_order_count_fob">'+stat['today']['order_count_fob']+'</span>件<br>CMT=<span id="today_order_count_cmt">'+stat['today']['order_count_cmt']+'</span>件<br>新CMT=<span id="today_order_count_cmt2">'+stat['today']['order_count_cmt2']+'</span>件</td>';
						html += '			';
						html += '			<td colspan="1" rowspan="3" class="value">件数目标：'+stat['month_target']['count']+'<span></span><br>金额目标：'+stat['month_target']['money']+'<span></span><br>加工费目标：'+stat['month_target']['cost']+'<span></span></td>';
						html += '			<td colspan="1" rowspan="3" class="value">件数完成：'+stat['completeness']['count']+'<span></span>%<br>金额完成：'+stat['completeness']['money']+'<span></span>%<br>加工费完成：'+stat['completeness']['cost']+'<span></span>%</td>';
						html += '			<td colspan="1" rowspan="3" class="value">达标率：'+stat['leadtime']['target_rate']+'<span></span>%<br>目标：'+stat['leadtime']['target']+'<span></span>%</td>';
						html += '			<td colspan="1" rowspan="3" class="value">金额：'+stat['year']['money']+'<span></span><br>目标：'+stat['year']['target']+'<span></span><br>完成率：'+stat['year']['target_rate']+'<span></span>%</td>';
						html += '		</tr>';
						html += '		<tr>';
						html += '			<td class="title">件数</td>';
						html += '			<td class="title">订单数</td>';
						html += '			<td class="title">件数</td>';
						html += '			<td class="title">订单数</td>';
						html += '			<td class="title">件数</td>';
						html += '			<td class="title">订单数</td>';
						html += '			<td class="title">件数</td>';
						html += '			<td class="title">订单数</td>';
						html += '			<td class="title">件数</td>';
						html += '			<td class="title">订单数</td>';
						html += '			<td class="title">加工费</td>';
						html += '			<td class="title">订单数</td>';
						html += '			<td class="title">加工费</td>';
						html += '			<td class="title">订单数</td>';
						html += '		</tr>';
						html += '		<tr>';
						html += '			<td class="value"><span id="last_month_shipment_jianshu">'+stat['last_month']['jianshu']+'</span></td>';
						html += '			<td class="value"><span id="last_month_shipment_order_count">'+stat['last_month']['order_count']+'</span></td>';
						html += '			<td class="value"><span id="month_shipment_jianshu">'+stat['month']['jianshu']+'</span></td>';
						html += '			<td class="value"><span id="month_shipment_order_count">'+stat['month']['order_count']+'</span></td>';
						html += '			<td class="value"><span id="yestoday_shipment_jianshu">'+stat['yestoday_over']['jianshu']+'</span></td>';
						html += '			<td class="value"><span id="yestoday_shipment_order_count">'+stat['yestoday_over']['order_count']+'</span></td>';
						html += '			<td class="value"><span id="yestoday_store_jianshu">'+stat['yestoday_store']['jianshu']+'</span></td>';
						html += '			<td class="value"><span id="yestoday_store_order_count">'+stat['yestoday_store']['order_count']+'</span></td>';
						
						html += '			<td class="value"><span id="today_shipment_jianshu">'+stat['today_over']['jianshu']+'</span></td>';
						html += '			<td class="value"><span id="today_shipment_order_count">'+stat['today_over']['order_count']+'</span></td>';
						html += '			<td class="value"><span id="yestoday_cost_money">'+stat['yestoday']['money_cost']+'</span></td>';
						html += '			<td class="value"><span id="yestoday_order_count">'+stat['yestoday']['order_count']+'</span></td>';
						html += '			<td class="value"><span id="today_cost_money">'+stat['today']['money_cost']+'</span></td>';
						html += '			<td class="value"><span id="today_order_count">'+stat['today']['order_count']+'</span></td>';
						html += '		</tr>';
						html += '	</table>';
	
					}
	
					$("#tb_chtj").html(html);
	
				}else layer.msg(res.msg, {icon: 2,anim: 6});
			}
		});
	}
	
	setTimeout("getChtj()", 1000);		// 出货统计
	setInterval("getChtj()", 1500000); 	// 25分钟
});
</script>